//
//  ShopperTableView.m
//  wtshoppingcite
//
//  Created by TW on 15-1-19.
//  Copyright (c) 2015年 TW. All rights reserved.
//

#import "ShopperTableView.h"
#import "NearTableViewCell.h"

@implementation ShopperTableView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
{
    self = [super initWithFrame:frame style:style];
    if(self){
        self.backgroundView = nil;
        self.backgroundColor = [UIColor whiteColor];
        self.dataSource = self;
        self.delegate = self;
        self.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    }
    return self;
}


#pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
   
    return 99;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.data count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   
        NearTableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"cellIdentitfer"];
        if (cell == nil) {
            cell = [[NearTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellIdentitfer"];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        
        cell.shoppingModel =self.data[indexPath.row];
        return cell;
        
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(self.eventsDelegate!= nil  && [self.eventsDelegate respondsToSelector:@selector(basetableView:didSelectRowAtIndexPath:)]){
        [self.eventsDelegate basetableView:self didSelectRowAtIndexPath:indexPath];
    }
    
}


@end
